home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
qbnws102.zip
/
GRAPHSPK.ZIP
/
BITON.BAS
next >
Wrap
BASIC Source File
|
1989-12-28
|
2KB
|
44 lines
' ========================== BITON.BAS ================================
' Quick Basic 4.5
' Copyright 1989 - Frederick Volking
' All Rights released to public domain by original author on 12/01/89
'
' =====================================================================
'
' This is a function. It tests an integer to determine if a specified
' BIT, in the integer, is set to 1 or 0. If the bit specified is 1,
' then the bit is considered ON and the function will return a TRUE(-1).
' If the specified bit is 0, then the bit is considered OFF and the
' function will return a FALSE(0).
'
' ==================================================================
' Author: Frederick Volking
' Contact: (415)952-3450 [home] (415)378-4640 [work]
' USPO Mail: 425 Larch Avenue - South San Francisco, CA 94080
' EchoMail: ANY Basic conference (I try to read them all)
' Library At: QBCentral BBS - Vancouver Washington (206)892-7500
' ==================================================================
DEFINT A-Z
FUNCTION BitOn (Which, IntVal)
BitOn = 0
SELECT CASE Which
CASE 1: IF (IntVal AND 128) THEN BitOn = (-1)
CASE 2: IF (IntVal AND 64) THEN BitOn = (-1)
CASE 3: IF (IntVal AND 32) THEN BitOn = (-1)
CASE 4: IF (IntVal AND 16) THEN BitOn = (-1)
CASE 5: IF (IntVal AND 8) THEN BitOn = (-1)
CASE 6: IF (IntVal AND 4) THEN BitOn = (-1)
CASE 7: IF (IntVal AND 2) THEN BitOn = (-1)
CASE 8: IF (IntVal AND 1) THEN BitOn = (-1)
CASE 9: IF (IntVal AND (-32768)) THEN BitOn = (-1)
CASE 10: IF (IntVal AND 16384) THEN BitOn = (-1)
CASE 11: IF (IntVal AND 8192) THEN BitOn = (-1)
CASE 12: IF (IntVal AND 4096) THEN BitOn = (-1)
CASE 13: IF (IntVal AND 2048) THEN BitOn = (-1)
CASE 14: IF (IntVal AND 1024) THEN BitOn = (-1)
CASE 15: IF (IntVal AND 512) THEN BitOn = (-1)
CASE 16: IF (IntVal AND 256) THEN BitOn = (-1)
END SELECT
END FUNCTION